module dungeon.klass;

import nade.ast;
import nade.loader;

import dungeon.game;
import dungeon.stats;


class Klass {
	this(Game game)
	{
		_game = game;
		_statsModified = new Stats();
	}

	string id() { return _id; }
	string name() { return _name; }
	string description() { return _description; }
	Stats statsModified() { return _statsModified; }

	protected {
		Game			_game;
		string			_id, _name;
		string			_description = "";

		Stats			_statsModified;
	}

	static void install()
	{
		Loader!(Klass).add("name",
			(ref Klass klass, AST ast, Object[string] state)
			{
				klass._id = ast[0].as!string;
				klass._name = ast[1].as!string;
				klass._game.addKlass(klass);
			}
		);

		Loader!(Klass).add("description",
			(ref Klass klass, AST ast, Object[string] state) { klass._description = ast[0].as!string; }
		);

		Loader!(Klass).add("mod",
			(ref Klass klass, AST ast, Object[string] state) { klass._statsModified.add(ast[0].as!string, ast[1].as!real); }
		);
	}
}
